import axios from 'axios';
import {
  LeadCoreAddCmd,
  LeadCorePageQry,
  LeadCoreView,
} from '@/types/crm/lead/lead-core';
import { Page } from "@/types/global-business";
import qs from "query-string";

export function createLeadCore(data: LeadCoreAddCmd) {
  return axios.post('/crm/lead-core', data);
}

export function fetchLeadCorePage(params: LeadCorePageQry) {
  return axios.get<Page<LeadCoreView>>('/crm/lead-core/page', {
    params,
    paramsSerializer: (obj) => {
      return qs.stringify(obj);
    },
  });
}
